package com.clinic.entity.db;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = DrugBrand.TABLE)
public class DrugBrand implements Serializable{

	private static final long serialVersionUID = 2030436868400444535L;

	public static final String TABLE = "drugbrand";
	
	public static final class Columns {
		public static final String BRAND_ID = "brandId";
		public static final String NAME = "name";
	}
	
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = Columns.BRAND_ID)
	private long brandId;
	
	@Column(name = Columns.NAME)
	private String name;
	
	@OneToMany(mappedBy="brand", cascade=CascadeType.ALL, fetch = FetchType.LAZY)
    private List<Drug> drugs;
	
	public long getBrandId() {
		return brandId;
	}

	public void setBrandId(long brandId) {
		this.brandId = brandId;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public List<Drug> getDrugs() {
		return drugs;
	}

	public void setDrugs(List<Drug> drugs) {
		this.drugs = drugs;
	}
	
}
